Imports System.Xml.Serialization
Imports System.ComponentModel
Imports Aricie.DNN.Caching.Client
Imports Aricie.DNN.Caching.Analysis
Imports Aricie.ComponentModel
Imports Aricie.DNN.UI.Attributes
Imports DotNetNuke.UI.Skins.Controls
Imports DotNetNuke.UI.WebControls
Imports Aricie.DNN.ComponentModel
Imports Aricie.DNN.UI.WebControls.EditControls
Imports Aricie.DNN.UI.WebControls
Imports DotNetNuke.Services.Localization

Namespace Aricie.DNN.Caching
    <Serializable()> _
    Public Class DistributedCachingProviderSettings
        Inherits AutoModuleConfig(Of DistributedCachingProviderSettings)



#Region "Private members"


        Private _Enabled As Boolean
        Private _EnableFastSettingsLoad As Boolean



        Private _LocalCacheSettings As New LocalCacheSettings
        Private _DistributedCachingSettings As New CachingClientSettings
        Private _CloudSettings As New CloudSettings
        Private _LoggingSettings As New LoggingSettings
        Private _AutoConfigSettings As New AutoConfigSettings
        Private _StatisticsSettings As New StatisticsSettings








#End Region

#Region "cTors"



        Public Sub New()

        End Sub


#End Region


#Region "Public Properties"



        Public Property Enabled() As Boolean
            Get

                Return _Enabled
            End Get
            Set(ByVal value As Boolean)
                _Enabled = value
            End Set
        End Property

        <XmlIgnore()> _
        Public ReadOnly Property EffectiveDistributedCachingEnabled() As Boolean
            Get
                Return Me.Enabled AndAlso Me.ClientSettings.AvailableClusters.Count > 0
            End Get
        End Property

        <TrialLimited(Security.Trial.TrialPropertyMode.Disable)> _
        Public Property EnableFastSettingsLoad() As Boolean
            Get
                Return _EnableFastSettingsLoad
            End Get
            Set(ByVal value As Boolean)
                _EnableFastSettingsLoad = value
            End Set
        End Property

        

        <ExtendedCategory("ClientSettings")> _
       Public Property ClientSettings() As CachingClientSettings
            Get
                Return _DistributedCachingSettings
            End Get
            Set(ByVal value As CachingClientSettings)
                _DistributedCachingSettings = value
            End Set
        End Property

        <ExtendedCategory("LocalCacheSettings")> _
        Public Property LocalCacheSettings() As LocalCacheSettings
            Get
                Return _LocalCacheSettings
            End Get
            Set(ByVal value As LocalCacheSettings)
                _LocalCacheSettings = value
            End Set
        End Property

        <ExtendedCategory("ClusterSettings")> _
       Public Property CloudSettings() As CloudSettings
            Get
                Return _CloudSettings
            End Get
            Set(ByVal value As CloudSettings)
                _CloudSettings = value
            End Set
        End Property

        <ExtendedCategory("ClusterSettings")> _
        <XmlIgnore()> _
        <Browsable(False)> _
       Public ReadOnly Property EffectiveEnabledDistributedCache() As Boolean
            Get
                Return Me.EffectiveDistributedCachingEnabled AndAlso Me.CloudSettings.EnableDistributedCache
            End Get
        End Property



        <ExtendedCategory("LoggingSettings")> _
        <Editor(GetType(PropertyEditorEditControl), GetType(EditControl))> _
           <LabelMode(LabelMode.Top)> _
       Public Property LoggingSettings() As LoggingSettings
            Get
                Return _LoggingSettings
            End Get
            Set(ByVal value As LoggingSettings)
                _LoggingSettings = value
            End Set
        End Property

        <ExtendedCategory("StatisticsSettings")> _
        <Editor(GetType(PropertyEditorEditControl), GetType(EditControl))> _
        <LabelMode(LabelMode.Top)> _
        Public Property StatisticsSettings() As StatisticsSettings
            Get
                Return _StatisticsSettings
            End Get
            Set(ByVal value As StatisticsSettings)
                _StatisticsSettings = value
            End Set
        End Property

        <ExtendedCategory("AutoConfigSettings")> _
        <Editor(GetType(PropertyEditorEditControl), GetType(EditControl))> _
        <LabelMode(LabelMode.Top)> _
        Public Property AutoConfigSettings() As AutoConfigSettings
            Get
                Return _AutoConfigSettings
            End Get
            Set(ByVal value As AutoConfigSettings)
                _AutoConfigSettings = value
            End Set
        End Property




#End Region


#Region "Public methods"


        Public Overrides Sub ClearSingleton(pe As AriciePropertyEditorControl)
            DistributedCachingProviderBase.ClearSettings()
            MyBase.ClearSingleton(pe)
        End Sub


        Public Overrides Sub Save(moduleName As String, locSettings As LocationSettings, useBinarySnapShot As Boolean)
            MyBase.Save(moduleName, locSettings, Me.EnableFastSettingsLoad)
            DistributedCachingProviderBase.ClearSettings()
        End Sub

        

        Public Overrides Function GetModuleName() As String
            Return DistributedCachingBusinessController.MODULE_NAME
        End Function

#End Region

#Region "private methods"



#End Region











        
    End Class
End Namespace